"""
好物社操作
"""
from time import sleep
from selenium.webdriver.common.by import By
from cases.basecase import BaseCase
from page.haowushe import HAOWUSHE
from tools.huadong import HUADONG
class TestRrz(BaseCase):
    def test_rrz_st_hws(self):
        #点击好物社
        ap = HAOWUSHE(self.driver)
        ap.dj_haowushe()
        sleep(1)
        # 向上滑动
        hd = HUADONG(self.driver)
        hd.swipe_up()
        sleep(1)
        # 向下滑动
        hd.swipe_down()
        sleep(1)
        #点击第一个商品
        ap.dj_diyigezuoping()
        sleep(3)
        #上下左右滑动
        hd.swipe_udlr()
        sleep(2)
        # #点击客服
        # ap.dj_kefu()
        # #点击取消
        # ap.dj_quxiao()
        # sleep(1)
        # #点击购物车
        # ap.dj_gouwuche()
        # #点击返回
        # ap.fanhui()
        # sleep(1)
        #点击分享按钮
        ap.dj_fenxiang()
        sleep(1)
        #点击取消
        ap.dj_quxiao()
        sleep(1)
        #点击首页
        ap.dj_shouye()
        sleep(1)
        #断言
        duanyan = "大家都在搜“日日煮星厨菜肴”"
        duanyan1 = self.driver.find_element(By.XPATH,'	/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView').get_attribute('text')
        self.assertEqual(duanyan,duanyan1)


